<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./constructor_prototype.js"></script>
  </head>
  <body>
    <!-- 业务逻辑 -->
    <script>
      const animal = new Animal("狗狗", "新鲜的骨头");
      console.log(animal);

      // 实例方法实际上是对原型对象中的方法地址引用
      // Animal.prototype.eat.call(animal) //实例的eat方法其实在引用其原型对象的eat方法
      // console.log(animal.eat === animal.__proto__.eat);//true 实例的eat方法其实在引用其原型对象的eat方法
      animal.eat();

      /*  */
      const p = new Person("张三丰",60)
      console.log(p);
      p.think()//Person.prototype.think.call(p)
      p.eat()

      /*  */
      const s = new Student("小学生库里",32,"扔三分")
      console.log(s);
      s.think()
      s.eat()
    </script>
  </body>
</html>
